9f48c3ff54dda90d94a4b854f3594faec524c465,src/main/java/ch/iterate/openstack/swift/handler/AuthenticationJson11ResponseHandler.java,AuthenticationJson11ResponseHandler,handleResponse,#HttpResponse#,30

Before Change


            catch(ParseException e) {
                throw new GenericException(e.getMessage(), e);
            }
            JSONObject auth = (JSONObject) json.get("auth");
            String token = ((JSONObject) auth.get("token")).get("id").toString();

            Map<String, String> cdnUrls = new HashMap<String, String>();
            JSONObject serviceCatalog = (JSONObject) auth.get("serviceCatalog");
            for(Object cloudFilesCDN : (JSONArray) serviceCatalog.get("cloudFilesCDN")) {
                String regionId = ((JSONObject) cloudFilesCDN).get("region").toString();
                String publicUrl = ((JSONObject) cloudFilesCDN).get("publicURL").toString();
                cdnUrls.put(regionId, publicUrl);
            }
            Set<Region> regions = new HashSet<Region>();
            for(Object cloudFiles : (JSONArray) serviceCatalog.get("cloudFiles")) {
                String regionId = ((JSONObject) cloudFiles).get("region").toString();
                String publicUrl = ((JSONObject) cloudFiles).get("publicURL").toString();
                String cdnUrl = cdnUrls.containsKey(regionId) ? cdnUrls.get(regionId) : null;
                Boolean v1Default = ((JSONObject) cloudFiles).containsKey("v1Default")

After Change


            try {
                final JsonParser parser = new JsonParser();
                final JsonObject json = parser.parse(new InputStreamReader(response.getEntity().getContent(), charset)).getAsJsonObject();
                final JsonObject auth = json.getAsJsonObject("auth");
                final String token = auth.getAsJsonObject("token").get("id").getAsString();
                final Map<String, String> cdnUrls = new HashMap<String, String>();
                JsonObject serviceCatalog = auth.getAsJsonObject("serviceCatalog");
                for(JsonElement e : serviceCatalog.getAsJsonArray("cloudFilesCDN")) {
                    final JsonObject cloudFilesCDN = e.getAsJsonObject();
                    String regionId = cloudFilesCDN.get("region").getAsString();
                    String publicUrl = cloudFilesCDN.get("publicURL").getAsString();
                    cdnUrls.put(regionId, publicUrl);
                }
                Set<Region> regions = new HashSet<Region>();
                for(JsonElement e : serviceCatalog.getAsJsonArray("cloudFiles")) {
                    JsonObject cloudFiles = e.getAsJsonObject();
                    String regionId = cloudFiles.get("region").getAsString();
                    String publicUrl = cloudFiles.get("publicURL").getAsString();
                    String cdnUrl = cdnUrls.containsKey(regionId) ? cdnUrls.get(regionId) : null;
                    Boolean v1Default = cloudFiles.get("v1Default") != null
                            ? cloudFiles.get("v1Default").getAsBoolean() : Boolean.FALSE;
                    regions.add(new Region(regionId, URI.create(publicUrl), cdnUrl == null ? null : URI.create(cdnUrl), v1Default));
                }